# #!/bin/bash

# # 等待用户输入SN号
# read -p "请输入边端SN号:" sn1
# read -p "请再次输入边端SN号:" sn2

# # 检查输入的SN号是否一致
# if [ "$sn1" == "$sn2" ]; then
#     echo "SN号写入成功:$sn1"

#     # 将SN号替换到配置文件中
#     sed -i "s@edge-demo@$sn1@g" /etc/kubeedge/config/edgecore.yaml
#     sed -i "s/ai20001/$sn1/g" /etc/rtty.conf
#     sed -i "s/hanweiSN/$sn1/g" /etc/update-motd.d/10-orangepi-header

#     systemctl enable edgecore.service

# else
#     echo "SN号写入失败:两次输入不一致,请重新写入..."
# fi

## !/bin/bash

# 检查参数是否为空
# if [ -z "\$1" ]; then
#     echo "请传入边端SN号作为参数"
#     exit 1
# fi

# sn="\$1"

# echo "SN号写入成功: $sn"

# 将SN号替换到配置文件中
# sed -i "s@edge-demo@$sn@g" /etc/kubeedge/config/edgecore.yaml
# sed -i "s/ai20001/$sn/g" /etc/rtty.conf
# sed -i "s/hanweiSN/$sn/g" /etc/update-motd.d/10-orangepi-header

# systemctl enable edgecore.service

# touch /userfs/${sn}.txt


# //设置静态ip
# nmcli con mod "Wired connection 1" ipv4.addresses "192.168.1.110/24" ipv4.gateway "192.168.1.1" ipv4.dns "8.8.8.8" ipv4.method "manual"

# 首先，将连接方式设置为自动获取IP地址：
# nmcli con mod "Wired connection 1" ipv4.method "auto"
# 然后，将IP地址设置为动态获取（0.0.0.0）：
# nmcli con mod "Wired connection 1" ipv4.addresses "0.0.0.0"
# 最后，重新加载网络连接以使更改生效：
# nmcli con down "Wired connection 1"
# nmcli con up "Wired connection 1"

#!/bin/bash

# 检查参数是否为空
if [ -z "$1" ]; then
    echo "请传入边端SN号作为参数"
else
    sn="$1"
    echo "SN号写入成功: $sn"

    # 将SN号替换到配置文件中
    # sed -i "s@edge-demo@$sn@g" /etc/kubeedge/config/edgecore.yaml
    sed -i "s/ai30001/$sn/g" /etc/rtty.conf
    # sed -i "s/hanweiSN/$sn/g" /etc/update-motd.d/10-orangepi-header

    # systemctl enable edgecore.service

    # touch "/userfs/sn.txt"
    # echo "123456" > "/userfs/sn.txt"
    echo "$sn" > "/userfs/sn.txt"
fi


